<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/7/10
 * Time: 12:18
 */

namespace app\api\validate;

class IDMustBePostiveInt extends BaseValidate
{
    protected $rule = [
        'id'  => 'require|isPositiveInteger'
    ];

    protected function isPositiveInteger($value,$rule='', $data='', $field='')
    {
        if(is_numeric($value) && is_int($value + 0) && ($value + 0) >0)
        {
            return true;
        }
        else
        {
            return $field.'必需是正整数';
        }
    }
}